# Stage 1: Build with Maven
FROM maven:3.8.4-openjdk-8 AS build-with-maven
RUN mkdir ./oauth-demo
COPY / ./oauth-demo/
WORKDIR ./oauth-demo/
RUN mvn clean package
# Stage 2: Run App
FROM openjdk:8 AS run-app
RUN mkdir ./oauth-demo
# Copy Artifact from Stage 1
COPY --from=build-with-maven ./oauth-demo/src/main/resources/ ./oauth-demo/src/main/resources/
COPY --from=build-with-maven ./oauth-demo/target/oauth-demo-0.0.1.jar ./oauth-demo/
CMD java  -jar ./oauth-demo/oauth-demo-0.0.1.jar --spring.profiles.active=${SPRING_PROFILES_ACTIVE}